class Simulator::SmallBodyParametersController < ApplicationController
	layout 'simulator/simulator'
	def edit
		@simulation = Simulation.find(params[:simulation_id])
		@small_body_parameter = SmallBodyParameter.find(params[:id])
	end

	def update
		@small_body_parameter = SmallBodyParameter.find(params[:id])
		@simulation = Simulation.find_by_id(@small_body_parameter.simulation_id)
		if @small_body_parameter.update_attributes(params[:small_body_parameter])
			@bodies = SimulationBody.create_test_particles(@simulation)
			flash[:notice] = "Small body parameters have been updated and #{@bodies}
												test particles have been generated"
			redirect_to :controller => 'systems', :action => 'show', :id => @simulation.system_id
		else
			flash[:notice] = "Small body parameter failed to update"
			redirect_to :controller => 'systems', :action => 'show', :id => @simulation.system_id
		end
	end	

end
